import 'package:flutter/material.dart';
import 'package:fun4live/pages/appSytyle.dart';
import 'package:fun4live/widgets/liveRoomCard.dart';
import 'package:get/get.dart';
import '../widgets/keep_alive_wrapper.dart';
import 'liveListController.dart';
import '../controller/baseController.dart';
import '../widgets/page_grid_view.dart';

class liveListView extends StatelessWidget{
  final String tag;
  const liveListView(this.tag, {Key?key}):super(key:key);
  liveListController get controller => Get.find<liveListController>(tag:tag);
  @override
  Widget build(BuildContext context) {
    var c = MediaQuery.of(context).size.width ~/ 180;
    if (c < 2) {
      c = 2;
    }
    //return Text("数据从这里来");
    return KeepAliveWrapper(
        child: PageGridView(
          pageController: controller,
          padding: AppStyle.edgeInsetsA12,
          firstRefresh: true,
          mainAxisSpacing: 12,
          crossAxisSpacing: 12,
          crossAxisCount: c,
          itemBuilder: (_,i){
            var item = controller.list[i];
            return liveRoomCard(controller.site,item);
          },

        ),
    );
  }

}